package com.laikan.reader.bookfriend.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import com.laikan.reader.bookfriend.fragment.impl.AttentionFragment;
import com.laikan.reader.bookfriend.fragment.impl.BookFragment;
import com.laikan.reader.bookfriend.fragment.impl.FunsFragment;
import com.laikan.reader.bookfriend.fragment.impl.ShorteFragment;
import com.laikan.reader.bookfriend.utils.Constant;

/**
 * Created by lingyt on 2016/11/17.
 * 个人主页的Fragment工厂
 */
public class AutherFactory {
    /**看点页*/
    public static final int TYPE_SHORTE = 1;
    /**作品页*/
    public static final int TYPE_BOOK = 2;
    /**粉丝页*/
    public static final int TYPE_FUNS = 4;
    /**关注页*/
    public static final int TYPE_ATTENTION = 5;



    public static Fragment createFragment(int type, String fragmentKey, String userId){
        Fragment fragment = null;
        switch (type){
            case TYPE_SHORTE:
                fragment = new ShorteFragment();
                break;
            case TYPE_BOOK:
                fragment = new BookFragment();
                break;
            case TYPE_FUNS:
                fragment = new FunsFragment();
                break;
            case TYPE_ATTENTION:
                fragment = new AttentionFragment();
                break;
        }
        if (fragment!=null){
            Bundle bundle = new Bundle();
            bundle.putString(Constant.FRAGMENT_KEY, fragmentKey);
            bundle.putString(Constant.USER_ID,userId);
            fragment.setArguments(bundle);
        }
        return fragment;
    }
}
